package start.doubudouyin;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import start.doubudouyin.utils.IconRead;
import start.doubudouyin.utils.VideoRead;

@SpringBootApplication
@EnableTransactionManagement //开启注解方式的事务管理
@MapperScan("start.doubudouyin.mapper")
public class DouBuDouYinApplication {

    public static void main(String[] args) {
        SpringApplication.run(DouBuDouYinApplication.class, args);
    }
    @Bean
    public CommandLineRunner init() {
        return args -> {
            // 设置IconRead的配置参数
            IconRead.setContextPath("/"); // 从配置文件或其他地方获取
            IconRead.setPort(8080); // 从配置文件或其他地方获取
        };
    }
    @Bean
    public CommandLineRunner initVideoConfig() {
        return args -> {
            // 设置VideoRead的配置参数
            VideoRead.setContextPath("/");
            VideoRead.setPort(8080);
            VideoRead.setVideoUrlPath("/video"); // 对应静态资源映射路径
        };
    }
}
